package com.dingreading.cloud.soms.util;

import com.dingreading.cloud.common.util.KitUtil;
import com.dingreading.cloud.common.util.NepUtil;
import com.dingreading.cloud.soms.entity.CaCallNames;
import com.dingreading.cloud.soms.entity.CaLessonEvaluate;

public class CaLessonEvaluateUtils {
    public static CaLessonEvaluate newBean(
            CaCallNames caCallNames, CaLessonEvaluate evaluate, String corpUid, String storeUid, String staffUid, String staffName,
            Integer teacherScore, String teacherComment
    ) {
        if (evaluate == null || evaluate.getId() == null || evaluate.getId() <= 0){
            evaluate = new CaLessonEvaluate();
            evaluate.setUid(KitUtil.getUuid());
            evaluate.setCallNamesUid(caCallNames.getUid());
            evaluate.setAgencyUid(corpUid);
            evaluate.setStoreUid(storeUid);
            evaluate.setTeacherUid(caCallNames.getTeacherUid());
            evaluate.setTeacherName(caCallNames.getTeacherName());
            evaluate.setStudentUid(caCallNames.getMemberUid());
            evaluate.setStudentName(caCallNames.getMemberName());
            evaluate.setPhone(caCallNames.getMob());
            evaluate.setScheduleUid(caCallNames.getScheduleUid());
            evaluate.setLessonUid(caCallNames.getLessonUid());
            evaluate.setTeachDate(caCallNames.getTeachDate());
            evaluate.setWeekNum(caCallNames.getWeekNum());
            evaluate.setWeekName(caCallNames.getWeekName());
            //todo
            evaluate.setProjectUid(caCallNames.getProjectUid());
            evaluate.setProjectName(caCallNames.getProductName());
            evaluate.setStageUid(caCallNames.getStageUid());
            evaluate.setStageName(caCallNames.getStageName());

            evaluate.setClassUid(caCallNames.getClassUid());
            evaluate.setClassName(caCallNames.getClassName());
            evaluate.setBeginTime(caCallNames.getBeginTime());
            evaluate.setEndTime(caCallNames.getEndTime());
            evaluate.setAddStaffUid(NepUtil.nullToZero(staffUid));
            evaluate.setAddStaffName(NepUtil.nullToZero(staffName));

        }
        evaluate.setTeacherScore(teacherScore);
        evaluate.setTeacherComment(teacherComment);
        evaluate.setLastStaffUid(NepUtil.nullToZero(staffUid));
        evaluate.setLastStaffName(NepUtil.nullToZero(staffName));
        return evaluate;
    }
}
